﻿Imports System
Imports System.Windows.Forms

''' <summary>
''' 简单的消息提示类
''' </summary>
''' <remarks></remarks>
Public Class msg

    ''' <summary>
    ''' 显示简单的提示信息
    ''' </summary>
    ''' <param name="strMsg"></param>
    ''' <remarks></remarks>
    Public Shared Sub Show(ByVal strMsg As String)
        MessageBox.Show(strMsg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
    End Sub

    ''' <summary>
    ''' 显示简单的警告信息
    ''' </summary>
    ''' <param name="strMsg"></param>
    ''' <remarks></remarks>
    Public Shared Sub ShowWarning(ByVal strMsg As String)
        MessageBox.Show(strMsg, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning)
    End Sub

    ''' <summary>
    ''' 显示简单的错误信息
    ''' </summary>
    ''' <param name="strMsg"></param>
    ''' <remarks></remarks>
    Public Shared Sub ShowError(ByVal strMsg As String)
        MessageBox.Show(strMsg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Sub

    ''' <summary>
    ''' 显示简单的错误信息
    ''' </summary>
    ''' <param name="strMsg"></param>
    ''' <param name="ex"></param>
    ''' <remarks></remarks>
    Public Shared Sub ShowError(ByVal strMsg As String, ByVal ex As Exception)
        MessageBox.Show(strMsg & ControlChars.NewLine & ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Sub

    ''' <summary>
    ''' 显示询问对话框（选择“是”或“否”）
    ''' </summary>
    ''' <param name="strMsg"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Shared Function ShowYesNo(ByVal strMsg As String) As DialogResult
        Return MessageBox.Show(strMsg, "选择", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
    End Function

    Public Shared Function ShowYesNoCancel(ByVal strMsg As String) As DialogResult
        Return MessageBox.Show(strMsg, "选择", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)
    End Function

    Public Shared Sub log(ByVal strMsg As String)
        MessageBox.Show(strMsg, "Debug", MessageBoxButtons.OK, MessageBoxIcon.Warning)
    End Sub

End Class